<?php

/**
 * workflowdef filter form base class.
 *
 * @package    forumCDE
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseworkflowdefFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'code'                        => new sfWidgetFormFilterInput(),
      'description'                 => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'etatinitial_id'              => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('etatinitial'), 'add_empty' => true)),
      'readonly'                    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'sansmails'                   => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'rolesnotification'           => new sfWidgetFormFilterInput(),
      'mailclient_id'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('mailclient'), 'add_empty' => true)),
      'mailvalideur_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('mailvalideur'), 'add_empty' => true)),
      'mailnotification_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('mailnotification'), 'add_empty' => true)),
      'scriptdeterminationvalideur' => new sfWidgetFormFilterInput(),
      'activeStatus'                => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'created_at'                  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'                  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'code'                        => new sfValidatorPass(array('required' => false)),
      'description'                 => new sfValidatorPass(array('required' => false)),
      'etatinitial_id'              => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('etatinitial'), 'column' => 'id')),
      'readonly'                    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'sansmails'                   => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'rolesnotification'           => new sfValidatorPass(array('required' => false)),
      'mailclient_id'               => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('mailclient'), 'column' => 'id')),
      'mailvalideur_id'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('mailvalideur'), 'column' => 'id')),
      'mailnotification_id'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('mailnotification'), 'column' => 'id')),
      'scriptdeterminationvalideur' => new sfValidatorPass(array('required' => false)),
      'activeStatus'                => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at'                  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'                  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('workflowdef_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'workflowdef';
  }

  public function getFields()
  {
    return array(
      'id'                          => 'Number',
      'code'                        => 'Text',
      'description'                 => 'Text',
      'etatinitial_id'              => 'ForeignKey',
      'readonly'                    => 'Boolean',
      'sansmails'                   => 'Boolean',
      'rolesnotification'           => 'Text',
      'mailclient_id'               => 'ForeignKey',
      'mailvalideur_id'             => 'ForeignKey',
      'mailnotification_id'         => 'ForeignKey',
      'scriptdeterminationvalideur' => 'Text',
      'activeStatus'                => 'Number',
      'created_at'                  => 'Date',
      'updated_at'                  => 'Date',
    );
  }
}
